<?php $header=$this->action('ZfcAdmin\Controller\AdminController', 'headerAction');
	  $baseUrl = $header->headerarray['baseUrl'];
?>
<?php if(isset($_SESSION['admin'])){?>
<html>
		<head>
			<?php if(isset($_GET['num_word_id']) && $_GET['num_word_id']!=""){?>
			<h1>Edit Number of Words</h1>
			<?}else{?>
			<h1>Add Number of Words</h1>
			<?}?>
		</head><br/>
		<body>
			<form id="add_num_form" name="add_num_form" method="post" action="">
				<?php $from_to=''; if(isset($this->num_words_details->num_words)){
			$from_to=explode('-',$this->num_words_details->num_words);?>
				From Number: 
				<select name="num_words" id="num_words">
					<option value=''>Select from number</option>
					<? for($i=0;$i<=2000;$i++){ if($i==$from_to['0']){?>
						<option value="<?php echo $i;?>" selected="selected"><?php echo $i;?></option>
					<?}else{?>
						<option value="<?php echo $i;?>"><?php echo $i;?></option>
					<?}}?>
				</select>
				<br/><br/>
				To Number: 
				<select name="to_num_words" id="to_num_words">
					<option value=''>Select to number</option>
					<? for($j=0;$j<=2000;$j++){ if($j==$from_to['1']){?>
						<option value="<?php echo $j;?>" selected="selected"><?php echo $j;?></option>
					<?}else{?>
						<option value="<?php echo $j;?>"><?php echo $j;?></option>
					<?}}?>
				</select>
			<?}else{?>
			From Number: 
				<select name="num_words" id="num_words">
					<option value=''>Select from number</option>
					<? for($i=0;$i<=2000;$i++){ ?>
						<option value="<?php echo $i;?>"><?php echo $i;?></option>
					<?}?>
				</select>
				<br/><br/>
				To Number: 
				<select name="to_num_words" id="to_num_words">
					<option value=''>Select to number</option>
					<? for($j=0;$j<=2000;$j++){ ?>
						<option value="<?php echo $j;?>"><?php echo $j;?></option>
					<?}?>
				</select>
			<?}?>			
				<br/><br/>
				Amount: <input type="text" name="num_amounts" value="<? if(isset($this->num_words_details->words_amount) && $this->num_words_details->words_amount!=""){echo $this->num_words_details->words_amount;}else{}?>" id="num_amounts" placeholder="Please enter number of amount" size="30"><br/><br/>
			<? if($this->base_range_exists=='false'){?>
				Base Range: <input type="checkbox" id="check_base_range" name="check_base_range" value='1'>
			<?} ?>
			<? if(isset($this->num_words_details->num_words) && $this->num_words_details->base_range=='1') {?>
				Base Range: <input type="checkbox" id="check_base_range" name="check_base_range" checked="checked" value='1'>
			<? }  ?><br/><br/>
				<a href="<? echo $baseUrl.'admin/number-words'?>">Back</a>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" id="btn_num" name="btn_num" value="Save" onClick="return add_num_words();">
				<input type="hidden" id="hid_num" name="hid_num" value="<? if(isset($this->num_words_details->num_word_id) && $this->num_words_details->num_word_id!=""){echo $this->num_words_details->num_word_id;}else{}?>">
			</form>
		</body>
</html>
<? } else {?>
<script>
	window.location=ADMIN_BASE_URL+'admin';
</script>
<?}?>